from fastapi.requests import Request

from utils.g import G
from utils.template.template import template


async def index(request: Request):
    request.state.logger.info("[访问页面] 首页")

    slideshow_list = await G.get_slideshow()
    products = await G.get_push_product(request.state.language)

    return template(request, "index.html", context={
        "nav": "home",
        "slideshow_list": slideshow_list,
        "products": products,
    })

